﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EMath {
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window {
		public MainWindow( ) {
			InitializeComponent( );
		}

		private void NewCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void NewExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void OpenCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void OpenExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}
		private void SaveCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void SaveExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}
		private void SaveAsCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void SaveAsExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void PrintCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void PrintPreviewExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}
		private void PrintExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void CloseCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void CloseExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
			this.Close( );
		}

		private void UndoCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void UndoExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void RedoCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void RedoExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void CutCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void CutExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void CopyCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void CopyExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void PasteCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void PasteExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void DeleteCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = false;
			e.Handled = true;
		}
		private void DeleteExecuted(object sender, ExecutedRoutedEventArgs e) {
			e.Handled = true;
		}

		private void Options_Click(object sender, RoutedEventArgs e) {
			Windows.Tools Tools = new Windows.Tools( );
			Tools.ShowDialog( );
		}

		private void HelpCanExecute(object sender, CanExecuteRoutedEventArgs e) {
			e.CanExecute = true;
			e.Handled = true;
		}
		private void HelpExecuted(object sender, ExecutedRoutedEventArgs e) {
			Windows.Help Help = new Windows.Help( );
			Help.ShowDialog( );
			e.Handled = true;
		}

		private void StudyBook_Click(object sender, RoutedEventArgs e) {
			Windows.StudyBook StudyBook = new Windows.StudyBook( );
			StudyBook.ShowDialog( );
		}
		[PreEmptive.Attributes.Feature("UpdateApp")]
		private void Update_Click(object sender, RoutedEventArgs e) {
			Windows.Update Update = new Windows.Update( );
			Update.ShowDialog( );
		}
		private void About_Click(object sender, RoutedEventArgs e) {
			Windows.About About = new Windows.About( );
			About.ShowDialog( );
		}

		private void ControlPanel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
			if (!(bool)e.NewValue) {
				this.ControlPanel.Content = null;
				this.ChoseControl.Visibility = System.Windows.Visibility.Visible;
			} else {
				this.ChoseControl.Visibility = System.Windows.Visibility.Hidden;
			}
		}

		private void SetContent(UserControl control) {
			this.ControlPanel.Content = control;
			this.ControlPanel.Visibility = System.Windows.Visibility.Visible;
		}

		// Arithmetic
		private void B_1_Click(object sender, RoutedEventArgs e) {
			//this.SetContent(new Controls.Arithmetic.Planimetrics"]);
		}
		private void B_PrimeNumbers_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["PrimeNumbers"]);
		}
		private void B_Divisibility_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Divisibility"]);
		}
		private void B_NumeralSystems_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["NumeralSystems"]);
		}
		private void B_Sets_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Sets"]);
		}

		// Algebra
		private void B_FieldOfSets_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["FieldOfSets"]);
		}
		private void B_MathematicalInduction_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["MathematicalInduction"]);
		}
		private void B_Combinatorics_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Combinatorics"]);
		}
		private void B_MathematicalLogic_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["MathematicalLogic"]);
		}
		private void B_Matrix_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Matrix"]);
		}
		private void B_ProbabilityTheory_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["ProbabilityTheory"]);
		}
		private void B_Relations_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Relations"]);
		}
		private void B_AlgebraicEquation_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["AlgebraicEquation"]);
		}
		private void B_Formula_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Formula"]);
		}

		private void B_DeMorgan_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["DeMorgan"]);
		}

		// Geometry
		private void B_AnalyticGeometry_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["AnalyticGeometry"]);
		}
		private void B_Planimetrics_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Planimetrics"]);
		}
		private void B_Stereometrics_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Stereometrics"]);
		}
		private void B_Trigonometry_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Trigonometry"]);
		}

		private void B_Pitagors_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Pitagoras"]);
		}
		private void B_Tales_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Tales"]);
		}

		// Analysis
		private void B_NumericalSequences_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["NumericalSequences"]);
		}
		private void B_Statistics_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Statistics"]);
		}
		private void B_Functions_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Functions"]);
		}
		private void B_LimitsAndContinuityOfFunctions_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["LimitsAndContinuityOfFunctions"]);
		}
		private void B_Calculus_Click(object sender, RoutedEventArgs e) {
			this.SetContent(App.ListUC["Calculus"]);
		}

		[PreEmptive.Attributes.Teardown( )]
		private void Window_Closed(object sender, EventArgs e) {
			App.Current.Shutdown( );
		}
	}
}